package com.rht.controller;

import java.util.Arrays;
import java.util.Map;

import com.rht.common.utils.PageUtils;
import com.rht.common.utils.R;
import com.rht.entity.AttrAttrgroupRelationEntity;
import com.rht.service.AttrAttrgroupRelationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.web.bind.annotation.RequestMapping;


/**
 * 属性&属性分组关联
 *
 * @author rht
 * @email 3171138599@qq.com
 * @date 2024-11-06 16:07:04
 */

@RestController
@RequestMapping("gulimallproduct/attrattrgrouprelation")
public class AttrAttrgroupRelationController {
    @Autowired
    private AttrAttrgroupRelationService attrAttrgroupRelationService;

    /**
     * 列表
     */
    @Operation(summary ="处理查询全部,分页查询的请求")
    @RequestMapping("/list")
      public R list(@RequestParam Map<String, Object> params){
        PageUtils page = attrAttrgroupRelationService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */

    @Operation(summary ="信息")
    @RequestMapping("/info/{id}")
      public R info(@PathVariable("id") Long id){
		AttrAttrgroupRelationEntity attrAttrgroupRelation = attrAttrgroupRelationService.getById(id);

        return R.ok().put("attrAttrgroupRelation", attrAttrgroupRelation);
    }

    /**
     * 保存
     */
    @Operation(summary ="保存")
    @RequestMapping("/save")
     public R save(@RequestBody AttrAttrgroupRelationEntity attrAttrgroupRelation){
		attrAttrgroupRelationService.save(attrAttrgroupRelation);

        return R.ok();
    }

    /**
     * 修改
     */
    @Operation(summary ="修改")
    @RequestMapping("/update")
     public R update(@RequestBody AttrAttrgroupRelationEntity attrAttrgroupRelation){
		attrAttrgroupRelationService.updateById(attrAttrgroupRelation);

        return R.ok();
    }

    /**
     * 删除
     */
    @Operation(summary ="删除")
    @RequestMapping("/delete")
      public R delete(@RequestBody Long[] ids){
		attrAttrgroupRelationService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
